home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77544_ots_column.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  7.1 KB  |  280 lines

  1. <%    '==================================================
  2.     ' Module:    ots_column.asp
  3.     '
  4.     ' Synopsis:    Object Task Selector Column Formatting Functions
  5.     '
  6.     ' Copyright (c) Microsoft Corporation.  All rights reserved.
  7.     '================================================== %>
  8. <%
  9.  
  10. '
  11. ' --------------------------------------------------------------
  12. ' C O L U M N  O B J E C T
  13. ' --------------------------------------------------------------
  14. '
  15.  
  16. Const OTS_COL_DIM             = 6
  17. Const OTS_COL_OBJECT        = 0
  18. Const OTS_COL_TYPE            = 1
  19. Const OTS_COL_HEADING        = 2
  20. Const OTS_COL_ALIGN            = 3
  21. Const OTS_COL_FLAGS            = 4
  22. Const OTS_COL_WIDTH            = 5
  23.  
  24. Const OTS_COL_TYPE_ALIGN_STYLE     = 0
  25. Const OTS_COL_OBJECT_ID         = "Col"    ' Note: DO NOT LOCALIZE
  26.  
  27.  
  28. Const OTS_COL_FLAG_HIDDEN     = 1
  29. Const OTS_COL_HIDDEN = 1
  30.  
  31. Const OTS_COL_FLAG_KEY         = 2
  32. Const OTS_COL_KEY = 2
  33.  
  34. Const OTS_COL_FLAG_SORT         = 4
  35. Const OTS_COL_SORT = 4
  36.  
  37. Const OTS_COL_FLAG_SEARCH = 8
  38. Const OTS_COL_SEARCH = 8
  39.  
  40.  
  41. ' --------------------------------------------------------------
  42. ' Function:    OTS_CreateColumn
  43. '
  44. ' Synopsis:    Create a column object
  45. '
  46. ' Arguments: colHeading    - Heading string
  47. '            colData          - Array of data
  48. '            colAlign    - Alignment attribute for column {left,center,right}
  49. '            colFlags    - Column flags 
  50. '                            (OTS_COL_FLAG_HIDDEN | OTS_COL_FLAG_KEY)
  51. ' --------------------------------------------------------------
  52. Public Function OTS_CreateColumn(ByVal colHeading, ByVal colAlign, ByVal colFlags)
  53.  
  54.     OTS_CreateColumn = OTS_CreateColumnEx(colHeading, colAlign, colFlags, 0)
  55.     
  56. End Function
  57.  
  58.  
  59. Public Function OTS_CreateColumnEx(ByVal colHeading, ByVal colAlign, ByVal colFlags, ByVal iColWidth)
  60.     Dim Column()
  61.     ReDim Column(OTS_COL_DIM)
  62.  
  63.     Column(OTS_COL_OBJECT) = OTS_COL_OBJECT_ID
  64.     Column(OTS_COL_TYPE) = OTS_COL_TYPE_ALIGN_STYLE
  65.     Column(OTS_COL_HEADING) = colHeading
  66.     Column(OTS_COL_ALIGN) = colAlign
  67.     Column(OTS_COL_FLAGS) = colFlags
  68.     Column(OTS_COL_WIDTH) = iColWidth
  69.  
  70.     OTS_CreateColumnEx = Column
  71.     
  72. End Function
  73.  
  74. Public Function OTS_IsColumnWidthDynamic(ByVal Column)
  75.     OTS_IsColumnWidthDynamic = FALSE
  76.     
  77.     SA_ClearError()
  78.     If (OTS_IsValidColumn(Column) ) Then
  79.         If ( Column(OTS_COL_WIDTH) > 0 ) Then
  80.             OTS_IsColumnWidthDynamic = TRUE
  81.         Else
  82.             OTS_IsColumnWidthDynamic = FALSE
  83.         End If
  84.     Else
  85.         Call SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnWidthDynamic")
  86.     End If
  87.  
  88. End Function
  89.  
  90.  
  91. Public Function OTS_GetColumnWidth(ByVal Column, byRef iWidth)
  92.     OTS_GetColumnWidth = gc_ERR_SUCCESS
  93.     
  94.     SA_ClearError()
  95.     If (OTS_IsValidColumn(Column) ) Then
  96.         iWidth = Column(OTS_COL_WIDTH)
  97.     Else
  98.         OTS_GetColumnWidth = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnWidth")
  99.     End If
  100.  
  101. End Function
  102.  
  103.  
  104. ' --------------------------------------------------------------
  105. ' Function:    OTS_IsValidColumn
  106. '
  107. ' Synopsis:    Verify that the reference object is a valid column. To
  108. '            be valid it must be an array, of the correct size,
  109. '            which has COL_OBJECT_ID as the first element
  110. ' --------------------------------------------------------------
  111. Private Function OTS_IsValidColumn(ByRef Column)
  112.     If (IsArray(Column) ) Then
  113.         If ( UBound(Column) >= OTS_COL_DIM ) Then
  114.             Dim colObject
  115.             colObject = Column(OTS_COL_OBJECT)
  116.             If (colObject = OTS_COL_OBJECT_ID) Then
  117.                 OTS_IsValidColumn = true
  118.                 Exit Function
  119.             Else
  120.                 SA_TraceOut "OTS_IsValidColumn", "(colObject <> OTS_COL_OBJECT_ID)"
  121.             End If
  122.         Else
  123.             SA_TraceOut "OTS_IsValidColumn", "(UBound(Column) >= OTS_COL_DIM)"
  124.         End If
  125.     Else
  126.         SA_TraceOut "OTS_IsValidColumn", "(IsArray(Column))"
  127.     End If
  128.     OTS_IsValidColumn = false
  129. End Function
  130.  
  131.  
  132. ' --------------------------------------------------------------
  133. ' Function:    OTS_GetColumnHeading
  134. '
  135. ' Synopsis:    Get the heading for the specified column
  136. ' --------------------------------------------------------------
  137. Public Function OTS_GetColumnHeading(ByRef Column, ByRef HeadingOut)
  138.     Dim rc
  139.     rc = gc_ERR_SUCCESS
  140.     
  141.     SA_ClearError()
  142.     If (OTS_IsValidColumn(Column) ) Then
  143.         HeadingOut = Column(OTS_COL_HEADING)
  144.     Else
  145.         rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnHeading")
  146.     End If
  147.  
  148.     OTS_GetColumnHeading = rc
  149. End Function
  150.  
  151.  
  152. ' --------------------------------------------------------------
  153. ' Function:    OTS_GetColumnAlign
  154. '
  155. ' Synopsis:    Get the alignment specified for this column
  156. ' --------------------------------------------------------------
  157. Public Function OTS_GetColumnAlign(ByRef Column, ByRef AlignOut)
  158.     Dim rc
  159.     rc = gc_ERR_SUCCESS
  160.     
  161.     SA_ClearError()
  162.     If (OTS_IsValidColumn(Column) ) Then
  163.         AlignOut = Column(OTS_COL_ALIGN)
  164.     Else
  165.         rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnAlign")
  166.     End If
  167.  
  168.     OTS_GetColumnAlign = rc
  169. End Function
  170.  
  171. ' --------------------------------------------------------------
  172. ' Function:    OTS_GetColumnFlags
  173. '
  174. ' Synopsis:    Check to see if the column is hidden
  175. ' --------------------------------------------------------------
  176. Public Function OTS_GetColumnFlags(ByRef Column, ByRef FlagsOut)
  177.     Dim rc
  178.     rc = gc_ERR_SUCCESS
  179.     
  180.     SA_ClearError()
  181.     If (OTS_IsValidColumn(Column) ) Then
  182.         FlagsOut = Column(OTS_COL_FLAGS)
  183.     Else
  184.         rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnFlags")
  185.     End If
  186.  
  187.     OTS_GetColumnFlags = rc
  188. End Function
  189.  
  190.  
  191. ' --------------------------------------------------------------
  192. ' Function:    OTS_IsColumnHidden
  193. '
  194. ' Synopsis:    Check to see if the column is hidden
  195. ' --------------------------------------------------------------
  196. Public Function OTS_IsColumnHidden(ByRef Column, ByRef HiddenOut)
  197.     Dim rc
  198.     rc = gc_ERR_SUCCESS
  199.     
  200.     SA_ClearError()
  201.     If (OTS_IsValidColumn(Column) ) Then
  202.         If (Column(OTS_COL_FLAGS) AND OTS_COL_FLAG_HIDDEN) Then
  203.             HiddenOut = true
  204.         Else
  205.             HiddenOut = false
  206.         End If
  207.     Else
  208.         rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnHidden")
  209.     End If
  210.     
  211.     OTS_IsColumnHidden = rc
  212. End Function
  213.  
  214. ' --------------------------------------------------------------
  215. ' Function:    OTS_IsColumnKey
  216. '
  217. ' Synopsis:    Check to see if the column is a key column
  218. ' --------------------------------------------------------------
  219. Public Function OTS_IsColumnKey(ByRef Column, ByRef KeyOut)
  220.     Dim rc
  221.     rc = gc_ERR_SUCCESS
  222.     
  223.     SA_ClearError()
  224.     If (OTS_IsValidColumn(Column) ) Then
  225.         If (Column(OTS_COL_FLAGS) AND OTS_COL_FLAG_KEY) Then
  226.             KeyOut = true
  227.         Else
  228.             KeyOut = false
  229.         End If
  230.     Else
  231.         rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnKey")
  232.     End If
  233.     
  234.     OTS_IsColumnKey = rc
  235. End Function
  236.  
  237.  
  238. ' --------------------------------------------------------------
  239. ' Function:    OTS_IsColumnSort
  240. '
  241. ' Synopsis:    Check to see if the column is the sort column
  242. ' --------------------------------------------------------------
  243. Public Function OTS_IsColumnSort(ByRef Column, ByRef SortOut)
  244.     Dim rc
  245.     rc = gc_ERR_SUCCESS
  246.     
  247.     SA_ClearError()
  248.     If (OTS_IsValidColumn(Column) ) Then
  249.         If (Column(OTS_COL_FLAGS) AND OTS_COL_FLAG_SORT) Then
  250.             SortOut = true
  251.         Else
  252.             SortOut = false
  253.         End If
  254.     Else
  255.         rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnSort")
  256.     End If
  257.     
  258.     OTS_IsColumnSort = rc
  259. End Function
  260.  
  261.  
  262. %>
  263.  
  264.